<template>
  <view>
    <u-datetime-picker
      :show="show"
      v-model="value"
      :mode="mode"
      @cancel="show = false"
      @close="show = false"
      @confirm="confirm"
    ></u-datetime-picker>
    <!-- <u-button @click="show = true">打开</u-button> -->
  </view>
</template>

<script>
export default {
  data() {
    return {
      show: false,
      value: "",
    };
  },
  props: {
    mode: {
      type: String,
      default: "date",
    },
  },
  methods: {
    confirm({ value }) {
      this.show = false;
      this.$emit("confirm", value);
    },
  },
};
</script>
